package com.payment.ktb.activity.main4;

import android.app.Dialog;
import android.content.Intent;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.payment.ktb.Interface.AlertInterface;
import com.payment.ktb.R;
import com.payment.ktb.activity.BaseActivity;
import com.payment.ktb.utils.AlertDialogUtils;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by admin on 2017/9/29.
 */

public class AgentMsgDetailApplyingActivity extends BaseActivity {

    @BindView(R.id.tv_agentmsgdetailapplying_phone)
    TextView tv_agentmsgdetailapplying_phone;
    @BindView(R.id.tv_agentmsgdetailapplying_name)
    TextView tv_agentmsgdetailapplying_name;







    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_agentmsgdetailapplying);
        ButterKnife.bind(this);
        initTitle("消息详情");

        initData();
    }



    private void initData() {

        String noticeContent = getIntent().getStringExtra("noticeContent");
        int index1 = noticeContent.indexOf("的");
        int index2 = noticeContent.indexOf("正在");
        int index3 = noticeContent.indexOf("联系电话");

        tv_agentmsgdetailapplying_name.setText(noticeContent.substring(index1 + 1,index2));
        tv_agentmsgdetailapplying_name.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
        tv_agentmsgdetailapplying_phone.setText(noticeContent.substring(index3));

        tv_agentmsgdetailapplying_phone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AlertDialogUtils.showAlertDialog(mContext, tv_agentmsgdetailapplying_phone.getText().toString().substring(5), "取消", "呼叫", new AlertInterface() {
                    @Override
                    public void confirm(Dialog alertDialog) {
                        startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + tv_agentmsgdetailapplying_phone.getText().toString().substring(5))));
                    }
                });
            }
        });

    }


}
